package com.jack.oopGame;

public abstract class Role {
    //公共属性
    //游戏角色拥有昵称name，等级level，血量blood，攻击力power，防御力defence，种族kind，
    private String name;  //昵称name
    private String level; //等级level
    private int blood;    //血量blood
    private int power;    //攻击力power
    private int defence;  //防御力defence
    private String kind;  //种族kind


    //判断是否死亡
    public boolean isDead(){
        if (this.getBlood()>0){   //没死
            return false;
        }else {
            this.setBlood(0);    //死了 ，血量恢复为0
            return true;
        }
    }

    //信息展示
    public String showInfo(){
        return this.toString();
    }


    @Override
    public String toString() {
        return "Role{" +
                "昵称='" + name + '\'' +
                ", 等级='" + level + '\'' +
                ", 血量=" + blood +
                ", 攻击力=" + power +
                ", 防御力=" + defence +
                ", 种族='" + kind + '\'' +
                '}';
    }

    //攻击 ,由子类实现
    public abstract void attack(Hero hero);

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }

    public int getDefence() {
        return defence;
    }

    public void setDefence(int defence) {
        this.defence = defence;
    }

    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }
}
